#if defined(TSINGMA_MX) || defined(TSINGMA_GX) || defined(ARCTIC)
/**
 @file sys_tsingma_mx_qos.h

 @date 2018-03-06

 @version v1.0

 The file contains tmm QoS funcation
*/

#ifndef _SYS_TMM_QOS_H
#define _SYS_TMM_QOS_H
#ifdef __cplusplus
extern "C" {
#endif

/****************************************************************
 *
 * Header Files
 *
 ***************************************************************/
extern int32
sys_tmm_qos_policer_free_statsptr(uint8 lchip, void* p_policer, uint32* p_stats_ptr);
extern int32
sys_tmm_qos_get_policer_param(uint8 lchip, void* p_param, void* p_policer);
extern int32
sys_tmm_qos_policer_alloc_offset(uint8 lchip, void* p_policer);
extern int32
sys_tmm_qos_policer_free_offset(uint8 lchip, void* p_policer);
extern int32
sys_tmm_qos_policer_add_to_asic(uint8 lchip, void* p_policer, void* p_profX,
                                                   void* p_profY, void* p_action_profile);
extern int32
sys_tmm_qos_policer_remove_from_asic(uint8 lchip, void* p_policer);
extern int32
sys_tmm_qos_policer_copp_add_to_asic(uint8 lchip, void* p_policer, void* p_prof);
extern int32
sys_tmm_qos_policer_deinit_opf(uint8 lchip);
extern int32
sys_tmm_qos_policer_init_opf(uint8 lchip);
extern int32
sys_tmm_qos_policer_spool_init(uint8 lchip);
extern int32
sys_tmm_qos_policer_spool_deinit(uint8 lchip);
extern int32
sys_tmm_qos_policer_init_reg(uint8 lchip);
extern int32
sys_tmm_qos_policer_copp_init(uint8 lchip);
extern int32
sys_tmm_qos_policer_restore_offset(uint8 lchip, void* p_policer);

extern int32
sys_tmm_shape_add_que_shp_to_asic(uint8 lchip, uint16 queue_id, uint8 queue_offset,
                                                          void* p_shape, uint8 is_pps);

extern int32
sys_tmm_shape_add_chan_shp_to_asic(uint8 lchip, uint16 channel, uint32 pir, uint32 pbs,
                                                           uint8 is_pps, uint8 enable);

extern int32
sys_tmm_shape_add_group_shape(uint8 lchip, uint32 group_id,  uint8 is_pps,
                                                    uint32 pir, uint32 pbs, uint8 enable);

extern int32
sys_tmm_shape_add_group_node_shape(uint8 lchip, uint32 group_id, uint8 group_node, uint8 is_pps,
                                                           uint32 pir, uint32 pbs, uint8 is_cir, uint8 enable);

extern int32
sys_tmm_shape_get_port_shape_profile(uint8 lchip, uint16 channel, uint32* rate, uint32* thrd, uint8* pps_en, uint8* p_shp_en);
extern int32
sys_tmm_shape_get_que_shape_profile(uint8 lchip, uint16 queue_id, uint16 queue_offset, void* p_shape);
extern int32
sys_tmm_shape_get_grp_shape_profile(uint8 lchip, uint32 group_id, uint32* rate, uint32* thrd, uint8* pps_en, uint8* p_shp_en);
extern int32
sys_tmm_shape_get_grp_node_shape_profile(uint8 lchip, uint32 group_id, uint8 group_node, uint8 is_cir, uint32* rate, uint32* thrd, uint8* pps_en, uint8* p_shp_en);
extern int32
sys_tmm_qos_set_reason_shp_base_pkt_en(uint8 lchip, uint8 enable);
extern int32
sys_tmm_queue_write_hash_key(uint8 lchip, uint32 service, uint16 dest_port_or_chan, uint16 group_id, uint8 type, uint8 is_lsp, uint32* p_key_index);

extern int32
sys_tmm_queue_del_hash_key(uint8 lchip, uint32 key_index);

extern int32
sys_tmm_queue_get_channel_by_group_id(uint8 lchip, uint32 group_id, uint16 *channel);

extern int32
sys_tmm_queue_get_channel_by_queue_id(uint8 lchip, uint16 queue_id, uint16 *channel);

extern int32
sys_tmm_queue_get_queue_base(uint8 lchip, uint8 channel, uint16 queue_offset, uint16* queue_base);

extern int32
sys_tmm_queue_flush(uint8 lchip,uint16 chan_id,uint16 group_id,uint8 flag, uint16 queue_id);

extern int32
sys_tmm_queue_set_port_drop_en(uint8 lchip, uint8 chan_id, bool enable);

extern int32
sys_tmm_sch_set_hsched(uint8 lchip, uint32 gport, uint16 group_id_l4, uint8 enable, uint8 type);

extern int32
sys_tmm_sch_set_group_sched(uint8 lchip, void* p_sched_grp);

extern int32
sys_tmm_sch_get_group_sched(uint8 lchip, void* p_sched_grp);

extern int32
sys_tmm_sch_set_queue_sched(uint8 lchip, uint16 queue_id, uint8 type, uint8 queue_offset, uint8 exceed_class, uint16 exceed_weight);
extern int32
sys_tmm_sch_get_queue_sched(uint8 lchip, uint16 queue_id, uint8 queue_offset, uint8* exceed_class, uint16* exceed_weight);

extern int32
sys_tmm_sch_create_sched_group(uint8 lchip, void* p_sched_grp, uint32 chan);

extern int32
sys_tmm_sch_destroy_sched_group(uint8 lchip, void* p_sched_grp);

extern int32
sys_tmm_sch_dump_sched_group_child_list(uint8 lchip, uint32 group_id);

extern int32
sys_tmm_resrc_set_que_drop(uint8 lchip, uint8 is_dynamic, uint8 enable, void* que_drop_array, void* p_queue);

extern int32
sys_tmm_resrc_fc_get_profile(uint8 lchip, uint16 chan_id, void *p_resrc_fc);

extern int32
sys_tmm_qos_shape_init(uint8 lchip);

extern int32
sys_tmm_qos_sch_init(uint8 lchip);

extern int32
sys_tmm_qos_queue_init(uint8 lchip);

extern int32
sys_tmm_qos_fcdl_recover_drop_pkt(uint8 lchip, void* p_sys_queue_node_param,  uint16 queue_id, uint8  chan_id, uint8 enable, uint8 pfc_en);

#ifdef __cplusplus
}
#endif

#endif
#endif

